
##### Load Packages and Data #####
library(tidyverse)
# Reminder - Load Post and Postsim functions!
# Note: To generate a figure in the R viewer, do NOT run dev.off() after running code for a figure. Alternatively, un-comment the file paths to save the figures. 

#setwd("")
Replication <- read.csv("replication.csv", header = TRUE)

##### Figure 1 #####

## Model Type 1 - OLS, No Interactions Between Traits and Engagement 

# Left-Right Identification
mod1_lr_nfc <- lm(dv_lr ~ nfc_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_lr_open <- lm(dv_lr ~ open_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_lr_schw <- lm(dv_lr ~ schw_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_lr_auth <- lm(dv_lr ~ auth_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_lr_latent <- lm(dv_lr ~ latent_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Economic Issue Preferences
mod1_econ_nfc <- lm(dv_econ ~ nfc_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_econ_open <- lm(dv_econ ~ open_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_econ_schw <- lm(dv_econ ~ schw_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_econ_auth <- lm(dv_econ ~ auth_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_econ_latent <- lm(dv_econ ~ latent_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Social Issue Preferences
mod1_social_nfc <- lm(dv_social ~ nfc_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_social_open <- lm(dv_social ~ open_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_social_schw <- lm(dv_social ~ schw_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_social_auth <- lm(dv_social ~ auth_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_social_latent <- lm(dv_social ~ latent_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Trade Issue Preferences
mod1_imports_nfc <- lm(dv_imports ~ nfc_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_imports_open <- lm(dv_imports ~ open_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_imports_schw <- lm(dv_imports ~ schw_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_imports_auth <- lm(dv_imports ~ auth_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_imports_latent <- lm(dv_imports ~ latent_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Limited Government 
mod1_limgov_nfc <- lm(dv_limgov ~ nfc_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_limgov_open <- lm(dv_limgov ~ open_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_limgov_schw <- lm(dv_limgov ~ schw_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_limgov_auth <- lm(dv_limgov ~ auth_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_limgov_latent <- lm(dv_limgov ~ latent_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Moral Traditionalism
mod1_trad_nfc <- lm(dv_trad ~ nfc_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_trad_open <- lm(dv_trad ~ open_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_trad_schw <- lm(dv_trad ~ schw_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_trad_auth <- lm(dv_trad ~ auth_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod1_trad_latent <- lm(dv_trad ~ latent_scale + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

## Put Models Into Data Frame ##

model1Frame <- data.frame(Variable = rownames(summary(mod1_lr_auth)$coef),
                          Coefficient = summary(mod1_lr_auth)$coef[, 1],
                          SE = summary(mod1_lr_auth)$coef[, 2],
                          Domain = "Left-Right Identification")
model1Frame <- model1Frame[2,]

model2Frame <- data.frame(Variable = rownames(summary(mod1_lr_open)$coef),
                          Coefficient = summary(mod1_lr_open)$coef[, 1],
                          SE = summary(mod1_lr_open)$coef[, 2],
                          Domain = "Left-Right Identification")
model2Frame <- model2Frame[2,]

model3Frame <- data.frame(Variable = rownames(summary(mod1_lr_nfc)$coef),
                          Coefficient = summary(mod1_lr_nfc)$coef[, 1],
                          SE = summary(mod1_lr_nfc)$coef[, 2],
                          Domain = "Left-Right Identification")
model3Frame <- model3Frame[2,]

model4Frame <- data.frame(Variable = rownames(summary(mod1_lr_schw)$coef),
                          Coefficient = summary(mod1_lr_schw)$coef[, 1],
                          SE = summary(mod1_lr_schw)$coef[, 2],
                          Domain = "Left-Right Identification")
model4Frame <- model4Frame[2,]

model5Frame <- data.frame(Variable = rownames(summary(mod1_lr_latent)$coef),
                          Coefficient = summary(mod1_lr_latent)$coef[, 1],
                          SE = summary(mod1_lr_latent)$coef[, 2],
                          Domain = "Left-Right Identification")
model5Frame <- model5Frame[2,]

model6Frame <- data.frame(Variable = rownames(summary(mod1_social_auth)$coef),
                           Coefficient = summary(mod1_social_auth)$coef[, 1],
                           SE = summary(mod1_social_auth)$coef[, 2],
                           Domain = "Cultural Policy")
model6Frame <- model6Frame[2,]

model7Frame <- data.frame(Variable = rownames(summary(mod1_social_open)$coef),
                           Coefficient = summary(mod1_social_open)$coef[, 1],
                           SE = summary(mod1_social_open)$coef[, 2],
                           Domain = "Cultural Policy")
model7Frame <- model7Frame[2,]

model8Frame <- data.frame(Variable = rownames(summary(mod1_social_nfc)$coef),
                          Coefficient = summary(mod1_social_nfc)$coef[, 1],
                          SE = summary(mod1_social_nfc)$coef[, 2],
                          Domain = "Cultural Policy")
model8Frame <- model8Frame[2,]

model9Frame <- data.frame(Variable = rownames(summary(mod1_social_schw)$coef),
                           Coefficient = summary(mod1_social_schw)$coef[, 1],
                           SE = summary(mod1_social_schw)$coef[, 2],
                           Domain = "Cultural Policy")
model9Frame <- model9Frame[2,]

model10Frame <- data.frame(Variable = rownames(summary(mod1_social_latent)$coef),
                          Coefficient = summary(mod1_social_latent)$coef[, 1],
                          SE = summary(mod1_social_latent)$coef[, 2],
                          Domain = "Cultural Policy")
model10Frame <- model10Frame[2,]

model11Frame <- data.frame(Variable = rownames(summary(mod1_trad_auth)$coef),
                           Coefficient = summary(mod1_trad_auth)$coef[, 1],
                           SE = summary(mod1_trad_auth)$coef[, 2],
                           Domain = "Moral Traditionalism")
model11Frame <- model11Frame[2,]

model12Frame <- data.frame(Variable = rownames(summary(mod1_trad_open)$coef),
                           Coefficient = summary(mod1_trad_open)$coef[, 1],
                           SE = summary(mod1_trad_open)$coef[, 2],
                           Domain = "Moral Traditionalism")
model12Frame <- model12Frame[2,]

model13Frame <- data.frame(Variable = rownames(summary(mod1_trad_nfc)$coef),
                           Coefficient = summary(mod1_trad_nfc)$coef[, 1],
                           SE = summary(mod1_trad_nfc)$coef[, 2],
                           Domain = "Moral Traditionalism")
model13Frame <- model13Frame[2,]

model14Frame <- data.frame(Variable = rownames(summary(mod1_trad_schw)$coef),
                           Coefficient = summary(mod1_trad_schw)$coef[, 1],
                           SE = summary(mod1_trad_schw)$coef[, 2],
                           Domain = "Moral Traditionalism")
model14Frame <- model14Frame[2,]

model15Frame <- data.frame(Variable = rownames(summary(mod1_trad_latent)$coef),
                           Coefficient = summary(mod1_trad_latent)$coef[, 1],
                           SE = summary(mod1_trad_latent)$coef[, 2],
                           Domain = "Moral Traditionalism")
model15Frame <- model15Frame[2,]

model16Frame <- data.frame(Variable = rownames(summary(mod1_econ_auth)$coef),
                           Coefficient = summary(mod1_econ_auth)$coef[, 1],
                           SE = summary(mod1_econ_auth)$coef[, 2],
                           Domain = "Economic Policy")
model16Frame <- model16Frame[2,]

model17Frame <- data.frame(Variable = rownames(summary(mod1_econ_open)$coef),
                          Coefficient = summary(mod1_econ_open)$coef[, 1],
                          SE = summary(mod1_econ_open)$coef[, 2],
                          Domain = "Economic Policy")
model17Frame <- model17Frame[2,]

model18Frame <- data.frame(Variable = rownames(summary(mod1_econ_nfc)$coef),
                           Coefficient = summary(mod1_econ_nfc)$coef[, 1],
                           SE = summary(mod1_econ_nfc)$coef[, 2],
                           Domain = "Economic Policy")
model18Frame <- model18Frame[2,]

model19Frame <- data.frame(Variable = rownames(summary(mod1_econ_schw)$coef),
                          Coefficient = summary(mod1_econ_schw)$coef[, 1],
                          SE = summary(mod1_econ_schw)$coef[, 2],
                          Domain = "Economic Policy")
model19Frame <- model19Frame[2,]

model20Frame <- data.frame(Variable = rownames(summary(mod1_econ_latent)$coef),
                           Coefficient = summary(mod1_econ_latent)$coef[, 1],
                           SE = summary(mod1_econ_latent)$coef[, 2],
                           Domain = "Economic Policy")
model20Frame <- model20Frame[2,]

model21Frame <- data.frame(Variable = rownames(summary(mod1_limgov_auth)$coef),
                           Coefficient = summary(mod1_limgov_auth)$coef[, 1],
                           SE = summary(mod1_limgov_auth)$coef[, 2],
                           Domain = "Limited Government")
model21Frame <- model21Frame[2,]

model22Frame <- data.frame(Variable = rownames(summary(mod1_limgov_open)$coef),
                           Coefficient = summary(mod1_limgov_open)$coef[, 1],
                           SE = summary(mod1_limgov_open)$coef[, 2],
                           Domain = "Limited Government")
model22Frame <- model22Frame[2,]

model23Frame <- data.frame(Variable = rownames(summary(mod1_limgov_nfc)$coef),
                           Coefficient = summary(mod1_limgov_nfc)$coef[, 1],
                           SE = summary(mod1_limgov_nfc)$coef[, 2],
                           Domain = "Limited Government")
model23Frame <- model23Frame[2,]

model24Frame <- data.frame(Variable = rownames(summary(mod1_limgov_schw)$coef),
                           Coefficient = summary(mod1_limgov_schw)$coef[, 1],
                           SE = summary(mod1_limgov_schw)$coef[, 2],
                           Domain = "Limited Government")
model24Frame <- model24Frame[2,]

model25Frame <- data.frame(Variable = rownames(summary(mod1_limgov_latent)$coef),
                           Coefficient = summary(mod1_limgov_latent)$coef[, 1],
                           SE = summary(mod1_limgov_latent)$coef[, 2],
                           Domain = "Limited Government")
model25Frame <- model25Frame[2,]

model26Frame <- data.frame(Variable = rownames(summary(mod1_imports_auth)$coef),
                           Coefficient = summary(mod1_imports_auth)$coef[, 1],
                           SE = summary(mod1_imports_auth)$coef[, 2],
                           Domain = "Free Trade Policy")
model26Frame <- model26Frame[2,]

model27Frame <- data.frame(Variable = rownames(summary(mod1_imports_open)$coef),
                           Coefficient = summary(mod1_imports_open)$coef[, 1],
                           SE = summary(mod1_imports_open)$coef[, 2],
                           Domain = "Free Trade Policy")
model27Frame <- model27Frame[2,]

model28Frame <- data.frame(Variable = rownames(summary(mod1_imports_nfc)$coef),
                           Coefficient = summary(mod1_imports_nfc)$coef[, 1],
                           SE = summary(mod1_imports_nfc)$coef[, 2],
                           Domain = "Free Trade Policy")
model28Frame <- model28Frame[2,]

model29Frame <- data.frame(Variable = rownames(summary(mod1_imports_schw)$coef),
                           Coefficient = summary(mod1_imports_schw)$coef[, 1],
                           SE = summary(mod1_imports_schw)$coef[, 2],
                           Domain = "Free Trade Policy")
model29Frame <- model29Frame[2,]

model30Frame <- data.frame(Variable = rownames(summary(mod1_imports_latent)$coef),
                           Coefficient = summary(mod1_imports_latent)$coef[, 1],
                           SE = summary(mod1_imports_latent)$coef[, 2],
                           Domain = "Free Trade Policy")
model30Frame <- model30Frame[2,]

allModelFrame <- data.frame(rbind(model1Frame, model2Frame, model3Frame, model4Frame, model5Frame, #lr
                                  model6Frame, model7Frame, model8Frame, model9Frame, model10Frame, #cultural
                                  model11Frame, model12Frame,  model13Frame, model14Frame, model15Frame, #moral
                                  model16Frame, model17Frame, model18Frame, model19Frame, model20Frame, # econ
                                  model21Frame, model22Frame, model23Frame,  model24Frame, model25Frame, #limgov
                                  model26Frame, model27Frame, model28Frame, model29Frame, model30Frame)) # trade

allModelFrame$Domain <- factor(allModelFrame$Domain, 
                                  levels = c("Left-Right Identification", "Cultural Policy", "Moral Traditionalism", "Economic Policy", "Limited Government", "Free Trade Policy"))
allModelFrame$Variable <- factor(allModelFrame$Variable, 
                               levels = c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"))


interval2 <- -qnorm((1-0.95)/2) # set 95% CI

zp1 <- ggplot(allModelFrame, aes(x = Domain, y = Coefficient, shape =  Variable))

zp1 <- zp1 + geom_hline(yintercept = 0, colour = gray(1/2), lty = 2)

zp1 <- zp1 + geom_pointrange(aes(x = Domain, y = Coefficient, ymin = Coefficient - SE*interval2, 
                                 ymax = Coefficient + SE*interval2), lwd = 1/2, position = position_dodge(width = 1/2))

zp1 <- zp1 + scale_shape_manual(name = "Personality Measure", 
                                values = c(0,2,1,6,5),
                                breaks=c("auth_scale", "open_scale", "nfc_scale", "schw_scale", "latent_scale"),
                                labels=c("Authoritarianism", "Openness to Experience (RC)", "Need for Closure", "Schwartz Conservation Values", "Latent Openness (RC)"))

zp1 <- zp1 + theme_bw() + theme(text=element_text(family="Times", face="bold", size=12)) +
        theme(axis.title.x = element_blank())
zp1 <- zp1

zp1 <- zp1 + scale_y_continuous(breaks=seq(-.40, .50, .10),
                     labels=c("-0.40", "", "-0.20", "", "0.00", "", "0.20", "", "0.40", ""),
                     limits=c(-.40, .50))

zp1
#ggsave(file="", zp1, width = 12, height = 5) 

##### Figure 2 #####

## Model Type 2 - OLS With Interactions Between Traits and Engagement 

# Left-Right Identification
mod2_lr_nfc <- lm(dv_lr ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_lr_open <- lm(dv_lr ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_lr_schw <- lm(dv_lr ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_lr_auth <- lm(dv_lr ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_lr_latent <- lm(dv_lr ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Economic Issue Preferences
mod2_econ_nfc <- lm(dv_econ ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_econ_open <- lm(dv_econ ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_econ_schw <- lm(dv_econ ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_econ_auth <- lm(dv_econ ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_econ_latent <- lm(dv_econ ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Social Issue Preferences
mod2_social_nfc <- lm(dv_social ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_social_open <- lm(dv_social ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_social_schw <- lm(dv_social ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_social_auth <- lm(dv_social ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_social_latent <- lm(dv_social ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Trade Imports Preferences
mod2_imports_nfc <- lm(dv_imports ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_imports_open <- lm(dv_imports ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_imports_schw <- lm(dv_imports ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_imports_auth <- lm(dv_imports ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_imports_latent <- lm(dv_imports ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Limited Government
mod2_limgov_nfc <- lm(dv_limgov ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_limgov_open <- lm(dv_limgov ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_limgov_schw <- lm(dv_limgov ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_limgov_auth <- lm(dv_limgov ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_limgov_latent <- lm(dv_limgov ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

# Moral Traditionalism
mod2_trad_nfc <- lm(dv_trad ~ nfc_scale + nfc_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_trad_open <- lm(dv_trad ~ open_scale + open_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_trad_schw <- lm(dv_trad ~ schw_scale + schw_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_trad_auth <- lm(dv_trad ~ auth_scale + auth_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)
mod2_trad_latent <- lm(dv_trad ~ latent_scale + latent_scale*engagement + age_scale + male + black + hisp + educ_scale +  income_scale + unemp + sample2 + sample3 + sample4 + engagement, data = Replication)

## Effects from 5th to 95th Percentile of Personality Type
attach(Replication)

quantile(nfc_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(open_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(schw_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(auth_scale,  probs = c(0.05, 0.95), na.rm = T)
quantile(latent_scale,  probs = c(0.05, 0.95), na.rm = T)

# Left-Right Identification
lr_nfc <- post(mod2_lr_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_open <- post(mod2_lr_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_schw <- post(mod2_lr_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_auth <- post(mod2_lr_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
lr_latent <- post(mod2_lr_latent, x1name =  "latent_scale", x1vals = c(.316,.856), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Economic Preferences
econ_nfc <- post(mod2_econ_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_open <- post(mod2_econ_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_schw <- post(mod2_econ_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_auth <- post(mod2_econ_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
econ_latent <- post(mod2_econ_latent, x1name =  "latent_scale", x1vals = c(.316,.856), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Social Preferences
social_nfc <- post(mod2_social_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_open <- post(mod2_social_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_schw <- post(mod2_social_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_auth <- post(mod2_social_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
social_latent <- post(mod2_social_latent, x1name =  "latent_scale", x1vals = c(.316,.856), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Trade Import Preferences
imports_nfc <- post(mod2_imports_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_open <- post(mod2_imports_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_schw <- post(mod2_imports_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_auth <- post(mod2_imports_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
imports_latent <- post(mod2_imports_latent, x1name =  "latent_scale", x1vals = c(.316,.856), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Limited Government Preference
limgov_nfc <- post(mod2_limgov_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_open <- post(mod2_limgov_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_schw <- post(mod2_limgov_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_auth <- post(mod2_limgov_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
limgov_latent <- post(mod2_limgov_latent, x1name =  "latent_scale", x1vals = c(.316,.856), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

# Moral Traditionalism Preference
trad_nfc <- post(mod2_trad_nfc, x1name =  "nfc_scale", x1vals = c(.32,.90), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_open <- post(mod2_trad_open, x1name =  "open_scale", x1vals = c(0,.684), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_schw <- post(mod2_trad_schw, x1name =  "schw_scale", x1vals = c(.32,.800), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_auth <- post(mod2_trad_auth, x1name =  "auth_scale", x1vals = c(0,1), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)
trad_latent <- post(mod2_trad_latent, x1name =  "latent_scale", x1vals = c(.316,.856), x2name = "engagement", x2vals = c(0, .25, .5, .75, 1), n.sims = 1000, seed = 1996, digits = 3)

detach(Replication)

## Figure 2

# LR-ID
#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=10)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_auth@est[3,1,1], lr_auth@est[3,1,2], lr_auth@est[3,1,3], lr_auth@est[3,1,4], lr_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_auth@est[3,2,1], lr_auth@est[3,2,2], lr_auth@est[3,2,3], lr_auth@est[3,2,4], lr_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_auth@est[3,3,1], lr_auth@est[3,3,2], lr_auth@est[3,3,3], lr_auth@est[3,3,4], lr_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_open@est[3,1,1], lr_open@est[3,1,2], lr_open@est[3,1,3], lr_open@est[3,1,4], lr_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_open@est[3,2,1], lr_open@est[3,2,2], lr_open@est[3,2,3], lr_open@est[3,2,4], lr_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_open@est[3,3,1], lr_open@est[3,3,2], lr_open@est[3,3,3], lr_open@est[3,3,4], lr_open@est[3,3,5]))
abline(h=0, lty=3)

title("Left-Right Identification", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_nfc@est[3,1,1], lr_nfc@est[3,1,2], lr_nfc@est[3,1,3], lr_nfc@est[3,1,4], lr_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_nfc@est[3,2,1], lr_nfc@est[3,2,2], lr_nfc@est[3,2,3], lr_nfc@est[3,2,4], lr_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_nfc@est[3,3,1], lr_nfc@est[3,3,2], lr_nfc@est[3,3,3], lr_nfc@est[3,3,4], lr_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_schw@est[3,1,1], lr_schw@est[3,1,2], lr_schw@est[3,1,3], lr_schw@est[3,1,4], lr_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_schw@est[3,2,1], lr_schw@est[3,2,2], lr_schw@est[3,2,3], lr_schw@est[3,2,4], lr_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_schw@est[3,3,1], lr_schw@est[3,3,2], lr_schw@est[3,3,3], lr_schw@est[3,3,4], lr_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

# Economic Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=10)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_auth@est[3,1,1], econ_auth@est[3,1,2], econ_auth@est[3,1,3], econ_auth@est[3,1,4], econ_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_auth@est[3,2,1], econ_auth@est[3,2,2], econ_auth@est[3,2,3], econ_auth@est[3,2,4], econ_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_auth@est[3,3,1], econ_auth@est[3,3,2], econ_auth@est[3,3,3], econ_auth@est[3,3,4], econ_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_open@est[3,1,1], econ_open@est[3,1,2], econ_open@est[3,1,3], econ_open@est[3,1,4], econ_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_open@est[3,2,1], econ_open@est[3,2,2], econ_open@est[3,2,3], econ_open@est[3,2,4], econ_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_open@est[3,3,1], econ_open@est[3,3,2], econ_open@est[3,3,3], econ_open@est[3,3,4], econ_open@est[3,3,5]))
abline(h=0, lty=3)

title("Economic Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_nfc@est[3,1,1], econ_nfc@est[3,1,2], econ_nfc@est[3,1,3], econ_nfc@est[3,1,4], econ_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_nfc@est[3,2,1], econ_nfc@est[3,2,2], econ_nfc@est[3,2,3], econ_nfc@est[3,2,4], econ_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_nfc@est[3,3,1], econ_nfc@est[3,3,2], econ_nfc@est[3,3,3], econ_nfc@est[3,3,4], econ_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_schw@est[3,1,1], econ_schw@est[3,1,2], econ_schw@est[3,1,3], econ_schw@est[3,1,4], econ_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_schw@est[3,2,1], econ_schw@est[3,2,2], econ_schw@est[3,2,3], econ_schw@est[3,2,4], econ_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_schw@est[3,3,1], econ_schw@est[3,3,2], econ_schw@est[3,3,3], econ_schw@est[3,3,4], econ_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Social Preferences

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=10)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_auth@est[3,1,1], social_auth@est[3,1,2], social_auth@est[3,1,3], social_auth@est[3,1,4], social_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_auth@est[3,2,1], social_auth@est[3,2,2], social_auth@est[3,2,3], social_auth@est[3,2,4], social_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_auth@est[3,3,1], social_auth@est[3,3,2], social_auth@est[3,3,3], social_auth@est[3,3,4], social_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_open@est[3,1,1], social_open@est[3,1,2], social_open@est[3,1,3], social_open@est[3,1,4], social_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_open@est[3,2,1], social_open@est[3,2,2], social_open@est[3,2,3], social_open@est[3,2,4], social_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_open@est[3,3,1], social_open@est[3,3,2], social_open@est[3,3,3], social_open@est[3,3,4], social_open@est[3,3,5]))
abline(h=0, lty=3)

title("Cultural Policy Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_nfc@est[3,1,1], social_nfc@est[3,1,2], social_nfc@est[3,1,3], social_nfc@est[3,1,4], social_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_nfc@est[3,2,1], social_nfc@est[3,2,2], social_nfc@est[3,2,3], social_nfc@est[3,2,4], social_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_nfc@est[3,3,1], social_nfc@est[3,3,2], social_nfc@est[3,3,3], social_nfc@est[3,3,4], social_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_schw@est[3,1,1], social_schw@est[3,1,2], social_schw@est[3,1,3], social_schw@est[3,1,4], social_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_schw@est[3,2,1], social_schw@est[3,2,2], social_schw@est[3,2,3], social_schw@est[3,2,4], social_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_schw@est[3,3,1], social_schw@est[3,3,2], social_schw@est[3,3,3], social_schw@est[3,3,4], social_schw@est[3,3,5]))
abline(h=0, lty=3)


dev.off()

## Imports

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=10)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_auth@est[3,1,1], imports_auth@est[3,1,2], imports_auth@est[3,1,3], imports_auth@est[3,1,4], imports_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_auth@est[3,2,1], imports_auth@est[3,2,2], imports_auth@est[3,2,3], imports_auth@est[3,2,4], imports_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_auth@est[3,3,1], imports_auth@est[3,3,2], imports_auth@est[3,3,3], imports_auth@est[3,3,4], imports_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_open@est[3,1,1], imports_open@est[3,1,2], imports_open@est[3,1,3], imports_open@est[3,1,4], imports_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_open@est[3,2,1], imports_open@est[3,2,2], imports_open@est[3,2,3], imports_open@est[3,2,4], imports_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_open@est[3,3,1], imports_open@est[3,3,2], imports_open@est[3,3,3], imports_open@est[3,3,4], imports_open@est[3,3,5]))
abline(h=0, lty=3)

title("Free Trade Preferences", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_nfc@est[3,1,1], imports_nfc@est[3,1,2], imports_nfc@est[3,1,3], imports_nfc@est[3,1,4], imports_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_nfc@est[3,2,1], imports_nfc@est[3,2,2], imports_nfc@est[3,2,3], imports_nfc@est[3,2,4], imports_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_nfc@est[3,3,1], imports_nfc@est[3,3,2], imports_nfc@est[3,3,3], imports_nfc@est[3,3,4], imports_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_schw@est[3,1,1], imports_schw@est[3,1,2], imports_schw@est[3,1,3], imports_schw@est[3,1,4], imports_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_schw@est[3,2,1], imports_schw@est[3,2,2], imports_schw@est[3,2,3], imports_schw@est[3,2,4], imports_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_schw@est[3,3,1], imports_schw@est[3,3,2], imports_schw@est[3,3,3], imports_schw@est[3,3,4], imports_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Limited Government Index

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=10)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_auth@est[3,1,1], limgov_auth@est[3,1,2], limgov_auth@est[3,1,3], limgov_auth@est[3,1,4], limgov_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.425,.40), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_auth@est[3,2,1], limgov_auth@est[3,2,2], limgov_auth@est[3,2,3], limgov_auth@est[3,2,4], limgov_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_auth@est[3,3,1], limgov_auth@est[3,3,2], limgov_auth@est[3,3,3], limgov_auth@est[3,3,4], limgov_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_open@est[3,1,1], limgov_open@est[3,1,2], limgov_open@est[3,1,3], limgov_open@est[3,1,4], limgov_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_open@est[3,2,1], limgov_open@est[3,2,2], limgov_open@est[3,2,3], limgov_open@est[3,2,4], limgov_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_open@est[3,3,1], limgov_open@est[3,3,2], limgov_open@est[3,3,3], limgov_open@est[3,3,4], limgov_open@est[3,3,5]))
abline(h=0, lty=3)

title("Principles of Limited Government", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_nfc@est[3,1,1], limgov_nfc@est[3,1,2], limgov_nfc@est[3,1,3], limgov_nfc@est[3,1,4], limgov_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_nfc@est[3,2,1], limgov_nfc@est[3,2,2], limgov_nfc@est[3,2,3], limgov_nfc@est[3,2,4], limgov_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_nfc@est[3,3,1], limgov_nfc@est[3,3,2], limgov_nfc@est[3,3,3], limgov_nfc@est[3,3,4], limgov_nfc@est[3,3,5]))
abline(h=0, lty=3)


par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_schw@est[3,1,1], limgov_schw@est[3,1,2], limgov_schw@est[3,1,3], limgov_schw@est[3,1,4], limgov_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_schw@est[3,2,1], limgov_schw@est[3,2,2], limgov_schw@est[3,2,3], limgov_schw@est[3,2,4], limgov_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_schw@est[3,3,1], limgov_schw@est[3,3,2], limgov_schw@est[3,3,3], limgov_schw@est[3,3,4], limgov_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

## Moral Traditionalism

#jpeg(file="", type="cairo", height = 5, width = 5.5, family="sans", units = 'in', res=1500, pointsize=10)

par(mfrow=c(2,2))
par(oma=c(0,0,2,0)) # adds space for main title

par(mar=c(4,4,2,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_auth@est[3,1,1], trad_auth@est[3,1,2], trad_auth@est[3,1,3], trad_auth@est[3,1,4], trad_auth@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel A: Authoritarianism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_auth@est[3,2,1], trad_auth@est[3,2,2], trad_auth@est[3,2,3], trad_auth@est[3,2,4], trad_auth@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_auth@est[3,3,1], trad_auth@est[3,3,2], trad_auth@est[3,3,3], trad_auth@est[3,3,4], trad_auth@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,3,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_open@est[3,1,1], trad_open@est[3,1,2], trad_open@est[3,1,3], trad_open@est[3,1,4], trad_open@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab= "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel B: Openness to Experience"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_open@est[3,2,1], trad_open@est[3,2,2], trad_open@est[3,2,3], trad_open@est[3,2,4], trad_open@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_open@est[3,3,1], trad_open@est[3,3,2], trad_open@est[3,3,3], trad_open@est[3,3,4], trad_open@est[3,3,5]))
abline(h=0, lty=3)

title("Moral Traditionalism", outer = TRUE)

par(mar=c(5,4,1,1))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_nfc@est[3,1,1], trad_nfc@est[3,1,2], trad_nfc@est[3,1,3], trad_nfc@est[3,1,4], trad_nfc@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel C: Need for Closure"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_nfc@est[3,2,1], trad_nfc@est[3,2,2], trad_nfc@est[3,2,3], trad_nfc@est[3,2,4], trad_nfc@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_nfc@est[3,3,1], trad_nfc@est[3,3,2], trad_nfc@est[3,3,3], trad_nfc@est[3,3,4], trad_nfc@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(5,3,1,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_schw@est[3,1,1], trad_schw@est[3,1,2], trad_schw@est[3,1,3], trad_schw@est[3,1,4], trad_schw@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab="Engagement", 
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Panel D: Schwartz Values"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_schw@est[3,2,1], trad_schw@est[3,2,2], trad_schw@est[3,2,3], trad_schw@est[3,2,4], trad_schw@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_schw@est[3,3,1], trad_schw@est[3,3,2], trad_schw@est[3,3,3], trad_schw@est[3,3,4], trad_schw@est[3,3,5]))
abline(h=0, lty=3)

dev.off()

##### Figure 3 #####

#jpeg(file="", type="cairo", height = 10, width = 8.5, family="sans", units = 'in', res=1800, pointsize=14)

par(mfrow=c(3,2))

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(lr_latent@est[3,1,1], lr_latent@est[3,1,2], lr_latent@est[3,1,3], lr_latent@est[3,1,4], lr_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Left-Right Identification"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(lr_latent@est[3,2,1], lr_latent@est[3,2,2], lr_latent@est[3,2,3], lr_latent@est[3,2,4], lr_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(lr_latent@est[3,3,1], lr_latent@est[3,3,2], lr_latent@est[3,3,3], lr_latent@est[3,3,4], lr_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(social_latent@est[3,1,1], social_latent@est[3,1,2], social_latent@est[3,1,3], social_latent@est[3,1,4], social_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Cultural Policy Preferences"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(social_latent@est[3,2,1], social_latent@est[3,2,2], social_latent@est[3,2,3], social_latent@est[3,2,4], social_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(social_latent@est[3,3,1], social_latent@est[3,3,2], social_latent@est[3,3,3], social_latent@est[3,3,4], social_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(trad_latent@est[3,1,1], trad_latent@est[3,1,2], trad_latent@est[3,1,3], trad_latent@est[3,1,4], trad_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Moral Traditionalism"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(trad_latent@est[3,2,1], trad_latent@est[3,2,2], trad_latent@est[3,2,3], trad_latent@est[3,2,4], trad_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(trad_latent@est[3,3,1], trad_latent@est[3,3,2], trad_latent@est[3,3,3], trad_latent@est[3,3,4], trad_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(2,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(econ_latent@est[3,1,1], econ_latent@est[3,1,2], econ_latent@est[3,1,3], econ_latent@est[3,1,4], econ_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Economic Policy Preferences"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(econ_latent@est[3,2,1], econ_latent@est[3,2,2], econ_latent@est[3,2,3], econ_latent@est[3,2,4], econ_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(econ_latent@est[3,3,1], econ_latent@est[3,3,2], econ_latent@est[3,3,3], econ_latent@est[3,3,4], econ_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,4,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(limgov_latent@est[3,1,1], limgov_latent@est[3,1,2], limgov_latent@est[3,1,3], limgov_latent@est[3,1,4], limgov_latent@est[3,1,5]), 
     type="p", 
     ylab="Effect", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Principles of Limited Government"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(limgov_latent@est[3,2,1], limgov_latent@est[3,2,2], limgov_latent@est[3,2,3], limgov_latent@est[3,2,4], limgov_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(limgov_latent@est[3,3,1], limgov_latent@est[3,3,2], limgov_latent@est[3,3,3], limgov_latent@est[3,3,4], limgov_latent@est[3,3,5]))
abline(h=0, lty=3)

par(mar=c(4,2,2,2))
plot(x = c(0,.25,.5,.75,1), 
     y=c(imports_latent@est[3,1,1], imports_latent@est[3,1,2], imports_latent@est[3,1,3], imports_latent@est[3,1,4], imports_latent@est[3,1,5]), 
     type="p", 
     ylab="", 
     xlab = "Engagement",
     axes=FALSE, 
     ylim=c(-.4,.4), 
     xlim=c(0,1))
title(main=list("Free Trade Preferences"))
axis(2, at=c(-.40, -.30,-.20,-.10,.00,.10,.20,.30, .40), labels=c("-.40","","-.20","",".00","",".20","", ".40"), las = 2)
axis(1, at=c(0,.25,.5,.75,1), labels=c(".00",".25",".50",".75","1.00"))
segments(x0 = c(0, .25, .5, .75, 1), y0 = c(imports_latent@est[3,2,1], imports_latent@est[3,2,2], imports_latent@est[3,2,3], imports_latent@est[3,2,4], imports_latent@est[3,2,5]), x1 = c(0, .25, .5, .75, 1), y1 = c(imports_latent@est[3,3,1], imports_latent@est[3,3,2], imports_latent@est[3,3,3], imports_latent@est[3,3,4], imports_latent@est[3,3,5]))
abline(h=0, lty=3)

dev.off()







